# coding=utf-8


"""This module is a wrapper for dimension requests"""

from pypalo.basic import response, url, default, arguments

request_group="dimension"

def clear(dimension, database, sid, host=default["host"], port=default["port"]):
	'''
	This function wraps PALO API Request
	http://[SERVER]:[PORT]/dimension/clear[?PARAMETER1=value[&...]].
	
	Parameters:
		dimension [identifier] <Identifier of a dimension>
		database [identifier] <Identifier of the database>
		sid [string] <Session identifier for a server connection. Use the /server/login request to get a valid session identifier.>
	
	Result:
		0 dimension [identifier] <Identifier of the dimension>
		1 name_dimension [string] <Name of the dimension>
		2 number_elements [integer] <Number of elements>
		3 maximum_level [integer] <Maximum level of the dimension>
		4 maximum_indent [integer] <Maximum indent of the dimension>
		5 maximum_depth [integer] <Maximum depth of the dimension>
		6 type [integer] <Type of dimension (0=normal, 1=system, 2=attribute)>
		7 attributes_dimension [identifier] <Identifier of the attributes dimension of a normal dimension or the identifier of the normal dimension associated to a attributes dimension.>
		8 attributes_cube [identifier] <Identifier of the attributes cube. (only for normal dimensions)>
		9 rights_cube [identifier] <Identifier of the rights cube. (only for normal dimensions)>
		10 dimension_token [integer] <The dimension token of the dimension>
	
	More info at http://host:port/api/dimension/clear
	'''
	#beginning of function suite
	request_name="clear"
	#end of function suite
	return response(url(host, port, request_group, request_name, arguments(locals())))

def create(new_name, database, sid, host=default["host"], port=default["port"], **keywords):
	'''
	This function wraps PALO API Request
	http://[SERVER]:[PORT]/dimension/create[?PARAMETER1=value[&...]].
	
	Parameters:
		new_name [string] <Name of the new dimension>
		type [identifier] <Type of the dimension (0=normal (default), 3=user info)>
		database [identifier] <Identifier of the database>
		sid [string] <Session identifier for a server connection. Use the /server/login request to get a valid session identifier.>
	
	Result:
		0 dimension [identifier] <Identifier of the dimension>
		1 name_dimension [string] <Name of the dimension>
		2 number_elements [integer] <Number of elements>
		3 maximum_level [integer] <Maximum level of the dimension>
		4 maximum_indent [integer] <Maximum indent of the dimension>
		5 maximum_depth [integer] <Maximum depth of the dimension>
		6 type [integer] <Type of dimension (0=normal, 1=system, 2=attribute)>
		7 attributes_dimension [identifier] <Identifier of the attributes dimension of a normal dimension or the identifier of the normal dimension associated to a attributes dimension.>
		8 attributes_cube [identifier] <Identifier of the attributes cube. (only for normal dimensions)>
		9 rights_cube [identifier] <Identifier of the rights cube. (only for normal dimensions)>
		10 dimension_token [integer] <The dimension token of the dimension>
		
	More info at http://host:port/api/dimension/create
	'''
	#beginning of function suite
	request_name="create"
	#end of function suite
	return response(url(host, port, request_group, request_name, arguments(locals())))

def cubes(dimension, database, sid, host=default["host"], port=default["port"], **keywords):
	'''
	This function wraps PALO API Request
	http://[SERVER]:[PORT]/dimension/cubes[?PARAMETER1=value[&...]].
	
	Parameters:
		database [identifier] <Identifier of the database>
		dimension [identifier] <Identifier of a dimension>
		show_normal [identifier] <Show cubes of type normal (0=do not show normal cubes, 1=show (default))>
		show_system [identifier] <Show cubes of type system (0=do not show system cubes (default), 1=show)>
		show_attribute [identifier] <Show cubes of type attribute (0=do not show attribute cubes (default), 1=show)>
		show_info [identifier] <Show cubes of type user info (0=do not show user info cubes (default), 1=show)>
		show_gputype 	identifier <Show cubes of type gpu type (0=do not show gpu type cubes , 1=show (default))>
		sid [string] <Session identifier for a server connection. Use the /server/login request to get a valid session identifier.>

	Result:
		0 cube [identifier] <Identifier of the cube>
		1 name_cube [string] <Name of the cube>
		2 number_dimensions [integer] <Number of dimensions>
		3 dimensions [identifier] <Comma separate list of dimension identifiers>
		4 number_cells [integer] <Total number of cells>
		5 number_filled_cells [integer] <Number of filled numeric base cells plus number of filled string cells>
		6 status [integer] <Status of cube (0=unloaded, 1=loaded and 2=changed)>
		7 type [integer] <Type of cube (0=normal, 1=system, 2=attribute, 3=user info, 4=gpu type)>
		8 cube_token [integer] <The cube token of the cube>
		
	More info at http://host:port/api/dimension/cubes
	'''
	#beginning of function suite
	request_name="cubes"
	#end of function suite
	return response(url(host, port, request_group, request_name, arguments(locals())))

def destroy(dimension, database, sid, host=default["host"], port=default["port"]):
	'''
	This function wraps PALO API Request
	http://[SERVER]:[PORT]/dimension/destroy[?PARAMETER1=value[&...]].
	
	Parameters:
		dimension [identifier] <Identifier of a dimension>
		database [identifier] <Identifier of the database>
		sid [string] <Session identifier for a server connection. Use the /server/login request to get a valid session identifier.>
	
	Result:
		0 OK [boolean] <"1" means OK>
	
	More info at http://host:port/api/dimension/destroy
	'''
	#beginning of function suite
	request_name="destroy"
	#end of function suite
	return response(url(host, port, request_group, request_name, arguments(locals())))

def element(position, dimension, database, sid, host=default["host"], port=default["port"]):
	'''
	This function wraps PALO API Request
	http://[SERVER]:[PORT]/dimension/element[?PARAMETER1=value[&...]].
	
	Parameters:
		position [integer] <Position of element>
		dimension [identifier] <Identifier of a dimension>
		database [identifier] <Identifier of the database>
		sid [string] <Session identifier for a server connection. Use the /server/login request to get a valid session identifier.>
	
	Result:
		0 element [identifier] <Identifier of the element>
		1 name_element [string] <Name of the element>
		2 position [integer] <Position of the element>
		3 level [integer] <Level of the element>
		4 indent [integer] <Indent of the element>
		5 depth [integer] <Depth of the element>
		6 type [integer] <Type of the element (1=NUMERIC, 2=STRING, 4=CONSOLIDATED)>
		7 number_parents [integer]<Number of parents>
		8 parents identifier [Comma separate list of parent identifiers]
		9 number_children [integer] <Number of children>
		10 children [identifier] <Comma separate list of children identifiers>
		11 weights [double] <Comma separate list of children weight>
		
	More info at http://host:port/api/dimension/element
	'''
	#beginning of function suite
	request_name="element"
	#end of function suite
	return response(url(host, port, request_group, request_name, arguments(locals())))

def elements(dimension, database, sid, host=default["host"], port=default["port"], **keywords):
	'''
	This function wraps PALO API Request
	http://[SERVER]:[PORT]/dimension/elements[?PARAMETER1=value[&...]].
	
	Parameters:
		parent [identifier] <Identifier of parent for element filtering or empty parameter for root elements. Root elements includes children of hidden elements. (no filter by default)>
		limit [identifier] <Comma delimited offset of first element returned (0-default) and maximal count of returned element (all elements by default)>
		dimension [identifier] <Identifier of a dimension>
		database [identifier] <Identifier of the database>
		sid [string] <Session identifier for a server connection. Use the /server/login request to get a valid session identifier.>
	
	Result:
		0 element [identifier] <Identifier of the element>
		1 name_element [string] <Name of the element>
		2 position [integer] <Position of the element>
		3 level [integer] <Level of the element>
		4 indent [integer] <Indent of the element>
		5 depth [integer] <Depth of the element>
		6 type [integer] <Type of the element (1=NUMERIC, 2=STRING, 4=CONSOLIDATED)>
		7 number_parents [integer]<Number of parents>
		8 parents identifier [Comma separate list of parent identifiers]
		9 number_children [integer] <Number of children>
		10 children [identifier] <Comma separate list of children identifiers>
		11 weights [double] <Comma separate list of children weight>
		
	More info at http://host:port/api/dimension/elements
	'''
	#beginning of function suite
	request_name="elements"
	#end of function suite
	return response(url(host, port, request_group, request_name, arguments(locals())))

def info(dimension, database, sid, host=default["host"], port=default["port"]):
	'''
	This function wraps PALO API Request
	http://[SERVER]:[PORT]/dimension/info[?PARAMETER1=value[&...]].
	
	Parameters:
		dimension [identifier] <Identifier of a dimension>
		database [identifier] <Identifier of the database>
		sid [string] <Session identifier for a server connection. Use the /server/login request to get a valid session identifier.>
	
	Result:
		0 dimension [identifier] <Identifier of the dimension>
		1 name_dimension [string] <Name of the dimension>
		2 number_elements [integer] <Number of elements>
		3 maximum_level [integer] <Maximum level of the dimension>
		4 maximum_indent [integer] <Maximum indent of the dimension>
		5 maximum_depth [integer] <Maximum depth of the dimension>
		6 type [integer] <Type of dimension (0=normal, 1=system, 2=attribute, 3=user info)>
		7 attributes_dimension [identifier] <Identifier of the attributes dimension of a normal dimension or the identifier of the normal dimension associated to a attributes dimension.>
		8 attributes_cube [identifier] <Identifier of the attributes cube. (only for normal dimensions)>
		9 rights_cube [identifier] <Identifier of the rights cube. (only for normal dimensions)>
		10 dimension_token [integer] <The dimension token of the dimension>
		
	More info at http://host:port/api/dimension/info
	'''
	#beginning of function suite
	request_name="info"
	#end of function suite
	return response(url(host, port, request_group, request_name, arguments(locals())))

def rename(new_name, dimension, database, sid, host=default["host"], port=default["port"]):
	'''
	This function wraps PALO API Request
	http://[SERVER]:[PORT]/dimension/rename[?PARAMETER1=value[&...]].
	
	Parameters:
		database [identifier] <Identifier of the database>
		dimension [identifier] <Identifier of the dimension>
		new_name [string] <New name of the dimension>
		sid [string] <Session identifier for a server connection. Use the /server/login request to get a valid session identifier.>
	
	Result:
		0 dimension [identifier] <Identifier of the dimension>
		1 name_dimension [string] <Name of the dimension>
		2 number_elements [integer] <Number of elements>
		3 maximum_level [integer] <Maximum level of the dimension>
		4 maximum_depth [integer] <Maximum depth of the dimension>
		5 type [integer] <Type of dimension (0=normal, 1=system, 2=attribute)>
		6 attributes_dimension [identifier] <Identifier of the attributes dimension of a normal dimension or the identifier of the normal dimension associated to a attributes dimension.>
		7 attributes_cube [identifier] <Identifier of the attributes cube. (only for normal dimensions)>
		8 rights_cube [identifier] <Identifier of the rights cube. (only for normal dimensions)>
		9 dimension_token [integer] <The dimension token of the dimension>
		
	More info at http://host:port/api/dimension/rename
	'''
	#beginning of function suite
	request_name="rename"
	#end of function suite
	return response(url(host, port, request_group, request_name, arguments(locals())))

def dfilter(cube, area, mode, dimension, database, sid, host=default["host"], port=default["port"], **keywords):
	'''
	This function wraps PALO API Request
	http://[SERVER]:[PORT]/dimension/dfilter[?PARAMETER1=value[&...]].
	
	Parameters:
		dimension [identifier] <Identifier of the dimension>
		database [identifier] <Identifier of the database>
		cube [identifier] <Identifier of a cube>
		area [area] <Comma separated list of element identifiers list. Each element identifiers list is colon separated. The area is the cartesian product. Elements for dimension specified is initial subset that will be filtered.
		mode [integer] <DATA_MIN = 1, DATA_MAX = 2, DATA_SUM = 4, DATA_AVERAGE = 8, DATA_ANY = 16, DATA_ALL = 32, DATA_STRING = 64, ONLY_CONSOLIDATED = 128, ONLY_LEAVES = 256, UPPER_PERCENTAGE = 512, LOWER_PERCENTAGE = 1024, MID_PERCENTAGE = 2048, TOP = 4096, NORULES = 8192>
		condition [string] <Condition on the value of numeric or string cells (default is no condition). A condition starts with >, >=, <, <=, ==, or != and is followed by a double or a string. Two condition can be combined by and, or, xor. If you specifiy a string value, the value has to be csv encoded. Do not forget to URL encode the complete condition string.>
		values [double] <Values for Top, Upper % and Lower % in this order.>
		sid [string] <Session identifier for a server connection. Use the /server/login request to get a valid session identifier.>
		
	Result:
		0 element [identifier] <Identifier of the element>
		1 name_element [string] <Name of the element>
		2 position [integer] <Position of the element>
		3 level [integer] <Level of the element>
		4 indent [integer] <Indent of the element>
		5 depth [integer] <Depth of the element>
		6 type [integer] <Type of the element (1=NUMERIC, 2=STRING, 4=CONSOLIDATED)>
		7 number_parents [integer] <Number of parents>
		8 parents [identifier] <Comma separate list of parent identifiers>
		9 number_children [integer] <Number of children>
		10 children [identifier] <Comma separate list of children identifiers>
		11 weights [double] <Comma separate list of children weight>
		12 type [integer] <Type of the accumulated value (1=NUMERIC, 2=STRING)>
		13 exists [boolean] <1 if at least one base cell for the path exists>
		14 value [double/string ] Accumulated value used for filtering
	
	More info at http://host:port/api/dimension/dfilter
	'''
	#beginning of function suite
	request_name="dfilter"
	#end of function suite
	return response(url(host, port, request_group, request_name, arguments(locals())))

#querys dictionary
query={}
query["clear"]=clear
query["create"]=create
query["cubes"]=cubes
query["destroy"]=destroy
query["element"]=element
query["elements"]=elements
query["info"]=info
query["rename"]=rename
query["dfilter"]=dfilter

#end of dimension module suite